
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import convert_to_codec as convert_to_codec
import audio_artist_fix

if __name__ == '__main__':
    base_dir = 'I:/分类音乐/歌手'
    artist_list = os.listdir(base_dir)
    print(artist_list)
    for artist_name in artist_list:
        dir_path = os.path.join(base_dir, artist_name)
        for root, dirs, files in os.walk(dir_path):
            for file in files:
                file_path = os.path.join(root, file)
                convert_to_codec.convert_to_codec(file_path, 'flac')
                new_file_path = os.path.splitext(os.path.basename(file_path))[0] + '.flac'
                new_file_path = os.path.join(root, new_file_path)
                audio_artist_fix.fix_artist(new_file_path, artist_name)